package com.googlecode.wicketcharts.showcase.options;

import java.awt.Color;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import com.googlecode.wicketcharts.highcharts.options.ChartOptions;
import com.googlecode.wicketcharts.highcharts.options.DummyOption;
import com.googlecode.wicketcharts.highcharts.options.Marker;
import com.googlecode.wicketcharts.highcharts.options.NamedPoint;
import com.googlecode.wicketcharts.highcharts.options.NamedPointSeriesOptions;
import com.googlecode.wicketcharts.highcharts.options.Options;
import com.googlecode.wicketcharts.highcharts.options.PlotOptions;
import com.googlecode.wicketcharts.highcharts.options.PlotOptionsChoice;
import com.googlecode.wicketcharts.highcharts.options.SeriesOptions;
import com.googlecode.wicketcharts.highcharts.options.SeriesType;
import com.googlecode.wicketcharts.highcharts.options.Symbol;
import com.googlecode.wicketcharts.highcharts.options.Symbol.PredefinedSymbol;
import com.googlecode.wicketcharts.highcharts.options.Title;
import com.googlecode.wicketcharts.highcharts.options.XAxis;
import com.googlecode.wicketcharts.highcharts.options.YAxis;

/**
 * Demo of the same spline chart with symbols as in the Highcharts demo at <a
 * href
 * ="http://www.highcharts.com/demo/spline-symbols">http://www.highcharts.com
 * /demo/spline-symbols</a>.
 * 
 * @author Tom Hombergs (tom.hombergs@gmail.com)
 * 
 */
public class SplineWithSymbolsOptions extends Options {

	private static final long serialVersionUID = 1L;
	
	public SplineWithSymbolsOptions(){
		ChartOptions chartOptions = new ChartOptions();
		chartOptions.setType(SeriesType.SPLINE);
		setChartOptions(chartOptions);
		
		setTitle(new Title("Monthly Average Temperature"));
		setTitle(new Title("Source: WorldClimate.com"));
		
		XAxis xAxis = new XAxis();
		xAxis.setCategories(Arrays
				.asList(new String[] { "Jan", "Feb", "Mar", "Apr", "May",
						"Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }));
		setxAxis(xAxis);
		
		YAxis yAxis = new YAxis();
		yAxis.setTitle(new Title("Temperature"));
		yAxis.setLabels(new DummyOption());
		setyAxis(yAxis);
		
		setTooltip(new DummyOption());
		
		Marker marker = new Marker();
		marker.setRadius(4);
		marker.setLineColor(Color.GRAY);
		marker.setLineWidth(1);
		
		PlotOptions plotOptions = new PlotOptions();
		plotOptions.setMarker(marker);
		
		PlotOptionsChoice plotOptionsChoice = new PlotOptionsChoice();
		plotOptionsChoice.setSpline(plotOptions);
		setPlotOptions(plotOptionsChoice);
		
		Marker pointMarker1 = new Marker();
		pointMarker1.setSymbol(new Symbol("http://www.highcharts.com/demo/gfx/sun.png"));
		
		Marker series1Marker = new Marker();
		series1Marker.setSymbol(new Symbol(PredefinedSymbol.SQUARE));
		
		NamedPointSeriesOptions series1 = new NamedPointSeriesOptions();
		series1.setMarker(series1Marker);
		series1.setName("Tokyo");
		series1.addNumbers(Arrays.asList(new Number[]{7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2}));
		NamedPoint point1 = new NamedPoint();
		point1.setY(26.5);
		point1.setMarker(pointMarker1);
		series1.addPoint(point1);
		series1.addNumbers(Arrays.asList(new Number[]{23.3, 18.3, 13.9, 9.6}));
		
		Marker pointMarker2 = new Marker();
		pointMarker2.setSymbol(new Symbol("http://www.highcharts.com/demo/gfx/snow.png"));
		
		Marker series2Marker = new Marker();
		series1Marker.setSymbol(new Symbol(PredefinedSymbol.DIAMOND));
		
		NamedPointSeriesOptions series2 = new NamedPointSeriesOptions();
		series2.setMarker(series2Marker);
		series2.setName("London");
		series2.addNumbers(Arrays.asList(new Number[]{3.9}));
		NamedPoint point2 = new NamedPoint();
		point2.setY(3.9);
		point2.setMarker(pointMarker2);
		series2.addPoint(point2);
		series2.addNumbers(Arrays.asList(new Number[]{4.2, 5.7, 8.5, 11.9, 15.2, 17.0, 16.6, 14.2, 10.3, 6.6, 4.8}));
		
		List<SeriesOptions<NamedPoint>> seriesList = new ArrayList<SeriesOptions<NamedPoint>>();
		seriesList.add(series1);
		seriesList.add(series2);
		setSeries(seriesList);
	
	}

}
